package com.itheima.controller;

import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

//被扫描
@Controller
//user/save
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    //配置路径
    //访问方法
    @ResponseBody //把返回的数据当做数据处理，不会再去找页面
//    @RequestMapping(value = "/save",method = {RequestMethod.GET})
    @RequestMapping("/save")
    public String save(){
        userService.save();
        System.out.println("save...");
        return "{'info':'hello'}";
    }
}
